$(function () {
    $("body").on('click','#successConfigPwd',function () {
        var userPassword = $("#userPassword").val();
        var confirmPassword = $("#confirmPassword").val();
        if(userPassword !=null && $.trim(userPassword) !=''){
            var encrypt = new JSEncrypt();
            encrypt.setPublicKey(publicKey);
            userPassword = encrypt.encrypt(userPassword);
        }
        if(confirmPassword !=null && $.trim(confirmPassword) !=''){
            var encrypt = new JSEncrypt();
            encrypt.setPublicKey(publicKey);
            confirmPassword = encrypt.encrypt(confirmPassword);
        }
        $.ajax({
            url:baseloaction +'/web/uc/setPerfectPwd',
            type:'post',
            dataType:'json',
            data:{
                'userPassword':userPassword,
                'confirmPassword':confirmPassword,
                'sign':sign
            },
            success:function (result) {
                if(result.success==true){
                    window.location.href = baseloaction +'/web/uc/course/user/index';
                }else{
                    sign = result.keyMap.sign;
                    publicKey = result.keyMap.publicKey;
                    icModale(0,'',result.message);
                }
            },
            error:function (error) {
                icModale(0,'','系统错误，登录密码设置失败');
            }
        });
    });
});